package tp.pr1;

public class Instruction {
	
	/**
	 * Constructores varios para parametros fallidos, accion, o accion con movimiento
	 */
	public Instruction (){
		this.action = Action.UNKNOWN;
		this.rotation = Rotation.UNKNOWN;
	}
	public Instruction (Action action){
		this.action = action;
		this.rotation = Rotation.UNKNOWN;
	}
	public Instruction (Action action, Rotation rotation){
		this.action = action;
		this.rotation = rotation;
	}
	
	/**
	 * 
	 * @return Accion de la instruccion
	 */
	public Action getAction (){
		return action;
	}
	/**
	 * 
	 * @return Rotacion de la instruccion
	 */
	public Rotation getRotation (){
		return rotation;
	}
	/**
	 * 
	 * @return si la instruccion es valida (tiene comando en el primer miembro y si es turn el segundo tambien)
	 */
	public boolean isValid (){
		return ((!action.equals(Action.UNKNOWN) && !action.equals(Action.TURN)) || (action.equals(Action.TURN) && !rotation.equals(Rotation.UNKNOWN)));
	}
	
	private Action action;
	private Rotation rotation;
	
}
